<?php $this->load->view(TEMPLATE_NAME.'/front/header'); ?>
<?php $this->load->view(TEMPLATE_NAME.'/front/side_left'); ?>
<script type="text/javascript" language="javascript">
function checkvalidation()
{
	if(document.getElementById('termsnandcon').checked == false)
	{
		document.getElementById('termsanconderror').style.display = 'block';
		return false; 
	} else {
		document.getElementById('termsanconderror').style.display = 'none';
	}
}
</script>
<div class="page">
<h2>Post News </h2>

<!--<div class="clear"></div>-->
<?php $this->load->view(TEMPLATE_NAME.'/front/news_header'); ?>
<?php //echo $news_id = $this->session->userdata('newsid'); 
//$news_content = $this->News_model->get_all_news($news_id);
//$user_info = $this->News_model->getuserinfo($news_content[0]['id_user_tiab']);
//$news_photo_info = $this->News_model->getallimages($news_id);
?>
<!--<div class="clear"></div>

<div class="clear"></div>-->

<!--<div id="previewbody">-->  <!--container to view news -->
<p class="phase"><strong>Preview your news article before posting it live</strong> - <span class="purple">Check below and click approved.</span><br>If you want to go back to change anything you can use the navigation above<!--</div>--></p>
<!--<div>-->
<div class="post"><h2 class="title"><!--<strong style="font-size:14px">--><?php echo $news_content[0]['article_heading'] ?></h2><!--</strong><br>-->
<p class="clear mb0" style="padding-bottom:0"></p>
<?php 
if($news_content[0]['is_anonymous'] != '1')
{
if($news_content[0]['by_network_post'] != '0')
	{
		$networkname = $this->News_model->get_network_name($news_content[0]['by_network_post']);
	?>
    <!--<span class="purple">--><div class="purple f13">By: <a href="<?php echo site_url('network/'.$networkname[0]['slug_name']); ?>"><?php echo $networkname[0]['name'] ?></a></div> <!--</span>-->
    <?php		
	} else {
	?>
<!--<span class="purple">--><div class="purple f13">By: <a href="<?php echo site_url('profile'); ?>"><?php echo $user_info[0]['firstname']." ".$user_info[0]['surname'] ?></a></div> <!--</span>-->
<?php
	}
	?>
<?php
} else { 
    ?>
    <div class="purple f13">By (Anonymous)</div>
    <?php
    }


$nextartnumber = $this->News_model->get_last_approved_artnumber();
$nextartnumber = $nextartnumber + 1;
?>
<!--</div>-->
<!--<div class="clear"></div> -->
<!--<div class="purple">-->
<div class="meta"><strong>Article #<?php echo $nextartnumber ?> </strong> &nbsp;|&nbsp; Posted at <?php echo date("H:i") ?> on <?php echo date("Y-m-d") ?> &nbsp;|&nbsp; <strong>-->0 Comments &nbsp;-&nbsp; 0 likes </strong> &nbsp;|&nbsp; Read 0 times</div>
<!--<div class="clear"></div>-->
<!--<div>--><div><?php echo $news_content[0]['article_description'] ?></div> <!--</div>--> <!--msg container -->
<!--<div class="clear"></div>-->
<!--<div>--> <!--image container -->
<?php //Please remove static if its not working ?>
<hr />
<?php //Please remove static if its not working 
if($news_photo_info)
{
	for($i=0;$i<count($news_photo_info);$i++)
	{
		list($width,$height) = getimagesize(base_url()."/uploads/news_photo/thumb/".$news_photo_info[$i]['news_image']."" );
		$width = $width + 26;
?>
<div class="cctv" style="width:<?php echo $width ?>px; margin:0px auto">
	<!--<div style="text-align:center">--><img src="<?php echo base_url();?>/uploads/news_photo/thumb/<?php echo $news_photo_info[$i]['news_image'] ?> " alt="<?php echo $news_content[0]['article_heading'] ?>"  /><!--</div>--><br />
<!-- <div>--><p><?php echo $news_photo_info[$i]['image_caption'] ?> </p> <!--</div>-->
</div><!-- cctv -->
<?php
	}
	?>
    <hr /> 
    <?php
}
?>

<?php
if($newscontent[0]['page_meta_keyword'] != "")
{
	?>
<!--<div>--><strong>Tags: <!--<span class="purple">--><a href=""><?php echo $news_content[0]['page_meta_keyword'] ?></a> <!--</span>--></strong><!--</div>--> <!--tags -->
<!--<div class="clear"></div>-->
<?php
?>
<hr />
<?php
}
?>

<div>
<?php  
if($sourcecontent)
{
for($i=0;$i < count($sourcecontent); $i++)
{
	?>
    <div><strong>Source:</strong>: <span class="purple"><?php echo $sourcecontent[$i]['source_name'] ?><?php if($sourcecontent[$i]['source_link'] != "") { ?> (<?php echo $sourcecontent[$i]['source_link'] ?>) <?php } ?></span></div>
    <div class="clear"></div>
    <?php
}
}
?>
</div>	<!--source lists -->
<!--<div class="clear"></div>-->
<!--<div>-->
<div id="termsbox" class="boxpost">
<p><strong>Terms and Conditions of posting your news</strong></p>
<p>I hereby confirm that I have read the <a href="<?php echo site_url('static_page/term_of_use'); ?>"  target="_blank">terms and conditions</a> of posting news on this website and that this news I am posting is fair and legitimate.</p>
<p><?php $tandc = 'id =  "termsnandcon"'; echo form_checkbox('termsnconditions','1',FALSE,$tandc); ?><strong>YES! I have read and agree to the terms and conditions stated</strong></p>
</div>
<p class="alertn" style="display:none" id="termsanconderror">Please agree to the terms and conditions before we post your article live</p>
<hr />
<div class="pleasenote">
	<!--<div style="text-align:center">--><p><strong>PLEASE NOTE:</strong> Once as article has been posted live it cannot be edited.<Br />
    Just as a publication would not edit an article once it was posted live.<!--</div>--></p>
	<!--<div style="text-align:center">-->
    <h4>
    <?php 
	$attributes = array('onSubmit' => 'return checkvalidation()');
	 echo form_open('news/news_preview',$attributes); 
	 ?>
     <input type="hidden" name="newsid" value="<?php echo $news_content[0]['id'] ?>" />
     <?php
	 echo form_submit('approve', 'APPROVE AND POST LIVE'); ?>
	 <?php echo form_close(); ?>
     <!--</div>--></h4>
<!--</div>--> <!--footer container -->
<!--<div class="clear"></div>-->
</div>
</div><!-- post -->
    <?php $this->load->view(TEMPLATE_NAME.'/front/footer_menu');?>
</div><!-- page -->

<?php $this->load->view(TEMPLATE_NAME.'/front/side_right');?> 
<?php $this->load->view(TEMPLATE_NAME.'/front/footer');?> 
